package com.game.data;

import com.dats.db.BaseDatS;
import com.dats.db.DatS;
import com.dats.entity.BaseGroup;
import com.dats.entity.BaseGroup2;
import com.dats.entity.BaseObj;
import com.dats.entity.CacheBean;
import com.dats.pool.DatSPool;
import com.game.dao.DatSDao;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author sig
 * @since 2016/9/25
 */
public class DataMg implements com.dats.i.DataI, DataI {

    @Override
    public <T extends BaseObj> void loadBase(Class<T> clazz) {
        BaseDatS.loadBase(DatSPool.baseAlias, clazz);
    }

    @Override
    public <T extends BaseObj> T getBase(Class<T> clazz, int baseId) {
        return BaseDatS.getBase(clazz, baseId);
    }

    @Override
    public <T extends BaseObj> List<T> getBaseList(Class<T> clazz) {
        return BaseDatS.getBaseList(clazz);
    }

    @Override
    public <T extends BaseObj> List<Integer> getBaseIdList(Class<T> clazz) {
        return BaseDatS.getBaseIdList(clazz);
    }

    @Override
    public <T extends BaseObj> Map<Integer, T> getBaseMap(Class<T> clazz) {
        return BaseDatS.getBaseMap(clazz);
    }

    @Override
    public <T extends BaseGroup> List<T> getBaseGroup(Class<T> clazz, int baseGroupId) {
        return BaseDatS.getBaseGroup(clazz, baseGroupId);
    }

    @Override
    public <T extends BaseGroup2> List<T> getBaseGroup2(Class<T> clazz, int baseGroupId2) {
        return BaseDatS.getBaseGroup2(clazz, baseGroupId2);
    }

    @Override
    public <T extends CacheBean> T loadBeanByValue(Class<T> clazz, long value) {
        return DatS.loadBeanByValue(DatSPool.userAlias, clazz, value);
    }

    @Override
    public <T extends CacheBean> List<T> loadBeanList(Class<T> clazz) {
        return DatS.loadBeanList(DatSPool.userAlias, clazz);
    }

    @Override
    public <T extends CacheBean> List<T> loadBeanList(Class<T> clazz, String sql) {
        return DatS.loadBeanList(DatSPool.userAlias, clazz, sql);
    }

    @Override
    public <T extends CacheBean> void saveBean(T t) {
        DatSDao.saveBean(t);
    }

    @Override
    public <T extends CacheBean> void saveBeanList(Collection<? extends T> list) {
        DatSDao.saveBeanList(list);
    }
}
